package com.ruoyi.web.controller.api;

import com.ruoyi.biz.domain.BizGoodsCategory;
import com.ruoyi.biz.domain.dto.CaculateGoodsDto;
import com.ruoyi.biz.service.IBizGoodsCategoryService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 商品类别信息Controller
 * 
 * @author ruoyi
 * @date 2022-11-06
 */
@RestController
@RequestMapping("/api/goodsCategory")
public class ApiGoodsCategoryController extends BaseController
{
    @Autowired
    private IBizGoodsCategoryService bizGoodsCategoryService;


    /**
     * 查询商品类别信息列表
     */
    @GetMapping("/list")
    public AjaxResult list(BizGoodsCategory bizGoodsCategory)
    {
        List<BizGoodsCategory> list = bizGoodsCategoryService.selectBizGoodsCategoryList(bizGoodsCategory);
        return success(list);
    }

    /**
     * 计算商品金额
     */
    @Log(title = "计算商品金额", businessType = BusinessType.OTHER)
    @GetMapping("/caculate")
    public AjaxResult caculate(@Validated CaculateGoodsDto caculateGoodsDto)
    {
        return success(bizGoodsCategoryService.caculate(caculateGoodsDto));
    }


}
